package com.zhaojk.audio.config;

import com.zhaojk.audio.mapper.handler.PgJsonbTypeHandler;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;

@Configuration
public class MyBatisConfig {
    private final SqlSessionFactory sqlSessionFactory;

    public MyBatisConfig(SqlSessionFactory sqlSessionFactory) {
        this.sqlSessionFactory = sqlSessionFactory;
    }

    @PostConstruct
    public void registerTypeHandlers() {
        sqlSessionFactory.getConfiguration().getTypeHandlerRegistry().register(PgJsonbTypeHandler.class);
    }
}

